import request from '@/utils/request'
import { ResMenuByRole, QueryMenuByRole, SetMenuReq } from '@/model/system/UpdateRoleMenu'

/**
 * 根据角色id获取所有菜单
 * @param data
 * @returns
 */
export function listByRole(data: QueryMenuByRole): Promise<Array<ResMenuByRole>> {
  return request.get<Array<ResMenuByRole>>('/api/auth/module/listByRole', data)
}

/**
 * 根据角色id设置菜单
 * @param data
 * @returns
 */
export function saveSetMenu(data: SetMenuReq): Promise<null> {
  return request.post<null>('/api/auth/module/updateModuleByRole', data)
}
